/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "sclgtbzona")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sclgtbzona.findAll", query = "SELECT s FROM Sclgtbzona s"),
    @NamedQuery(name = "Sclgtbzona.findBySclgtbzonaid", query = "SELECT s FROM Sclgtbzona s WHERE s.sclgtbzonaid = :sclgtbzonaid"),
    @NamedQuery(name = "Sclgtbzona.findByNombre", query = "SELECT s FROM Sclgtbzona s WHERE s.nombre = :nombre"),
    @NamedQuery(name = "Sclgtbzona.findByObservaciones", query = "SELECT s FROM Sclgtbzona s WHERE s.observaciones = :observaciones")})
public class Sclgtbzona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "sclgtbzonaid")
    private Integer sclgtbzonaid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @JoinColumn(name = "sclgtbpaisid", referencedColumnName = "sclgtbpaisid")
    @ManyToOne(optional = false)
    private Sclgtbpais sclgtbpaisid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sclgtbzonaid")
    private Collection<Sclgtbprovinc> sclgtbprovincCollection;

    public Sclgtbzona() {
    }

    public Sclgtbzona(Integer sclgtbzonaid) {
        this.sclgtbzonaid = sclgtbzonaid;
    }

    public Sclgtbzona(Integer sclgtbzonaid, String nombre) {
        this.sclgtbzonaid = sclgtbzonaid;
        this.nombre = nombre;
    }

    public Integer getSclgtbzonaid() {
        return sclgtbzonaid;
    }

    public void setSclgtbzonaid(Integer sclgtbzonaid) {
        this.sclgtbzonaid = sclgtbzonaid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public Sclgtbpais getSclgtbpaisid() {
        return sclgtbpaisid;
    }

    public void setSclgtbpaisid(Sclgtbpais sclgtbpaisid) {
        this.sclgtbpaisid = sclgtbpaisid;
    }

    @XmlTransient
    public Collection<Sclgtbprovinc> getSclgtbprovincCollection() {
        return sclgtbprovincCollection;
    }

    public void setSclgtbprovincCollection(Collection<Sclgtbprovinc> sclgtbprovincCollection) {
        this.sclgtbprovincCollection = sclgtbprovincCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sclgtbzonaid != null ? sclgtbzonaid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sclgtbzona)) {
            return false;
        }
        Sclgtbzona other = (Sclgtbzona) object;
        if ((this.sclgtbzonaid == null && other.sclgtbzonaid != null) || (this.sclgtbzonaid != null && !this.sclgtbzonaid.equals(other.sclgtbzonaid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Sclgtbzona[ sclgtbzonaid=" + sclgtbzonaid + " ]";
    }
    
}
